<?php
//引入初始化文件
include '../init.php';
//引入数据库连接文件
include DIR_CORE .'mysql.php';

$title = "沐水莲心- 在线考试";

session_start();
$name = $_SESSION['userInfo']['name'];

//测试时间
$time = time();

$singleCount=80; //单选题数
$multipleCount = 5; //多选题数
$judgeCount = 10; //判断题数
$fillCount = 5; //填空题数
$per = 1;

//随机取80道题
$sql = "SELECT * FROM single ORDER BY rand() LIMIT $singleCount";
$res = mysqli_query($link, $sql);
$list = array();
while ($row = mysqli_fetch_assoc($res)) {
    $list[] = $row;
}
//var_dump($list);

//随机5道多选题
$msql = "SELECT * FROM multiple ORDER BY rand() LIMIT $multipleCount";
$mres = mysqli_query($link, $msql);
$mlist = array();
while ($mrow = mysqli_fetch_assoc($mres)) {
    $mlist[] = $mrow;
}
//var_dump($mlist);

//随机5道填空题
$fsql = "SELECT * FROM fill ORDER BY rand() LIMIT $fillCount";
$fres = mysqli_query($link, $fsql);
$flist = array();
while ($frow = mysqli_fetch_assoc($fres)) {
    $flist[] = $frow;
}
//var_dump($flist);

//随机5道判断题
$jsql = "SELECT * FROM judge ORDER BY rand() LIMIT $judgeCount";
$jres = mysqli_query($link, $jsql);
$jlist = array();
while ($jrow = mysqli_fetch_assoc($jres)) {
    $jlist[] = $jrow;
}
//var_dump($jlist);
include DIR_VIEW .'test.html';
